{include file="public/header"}
<body>
<style>
	.res_section1{
		padding: 10px;
	}
	.res_section1 .all_1 .dhh{
		background: url("__PUBLIC__/home/images/v10_a19.png");
		background-size: 100% 100%;
		padding: 10px;
	}
	.res_section1 .all_1 .f1{
		border-bottom: none;
	}
	.res_section1 .all_1 .s1{
		display: block !important;
		margin-bottom: 10px;
	}
	.res_section1 .all_1 .f1 input{
		float: inherit !important;
		width: 100% !important;
		text-align: left !important;
		background: #292f71 !important;
		text-indent: 0.5rem;
		padding: 3px 0px;
	}
</style>
<div class="bg_fixed_v10_1"></div>
	<div class="sectionY sectionY_tttt">
		<a href="{:url('User/index')}">
			<img src="__PUBLIC__/home/images/v10_a9.png" alt="" class="a1">
		</a>
		<p class="p1">
			<span class="ppp_title">实名认证</span>
		</p>
	</div>
	<div class="kong1"></div>
	<div class="res_section1" style="margin-top: 15px">
			<div class="all_1">
				<div class="dhh">
					<div class="f1">
						<p class="s1 ">真实姓名：</p>
						<input type="text" name='realname' value="{$userinfo.realname}" class="input1" placeholder="请填写真实姓名" autocomplete="off">
					</div>
					<div class="f1">
						<span class="s1 ">证件号码：</span>
						<input type="text" name='code' value="{$userinfo.selfcard}" class="input1" placeholder="请填写证件号码" autocomplete="off">
					</div>

					<div class="f1">
						<span class="s1 ">紧急联系人：</span>
						<input type="text" name='mustman' class="input1" value="{$userinfo.mustman}" placeholder="请输入紧急联系人电话" autocomplete="off">
					</div>
				</div>
				
				<div class="sub" style="padding: 20px 0px">
					<input type="submit" value="确认提交">
				</div>
			</div>
	</div>
</body>
</html>
<script type="text/javascript">
$(function(){
    /*重置密码*/
	$("input[type=submit]").click(function(){
		var realname		= $('input[name=realname]').val();
		var code	= $('input[name=code]').val();
		var mustman	= $('input[name=mustman]').val();
		if(realname==''){
			layer.alert('请输入真实姓名！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}
        var nameReg = /^[\u4E00-\u9FA5]{2,4}$/;
        if(!nameReg.test(realname)){
			layer.alert('真实姓名格式错误，请检查！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}

		if(code==''){
			layer.alert('请输入身份证号！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}
        var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
		if(!pattern.test(code)){
			layer.alert('身份证号码格式错误，请检查！',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}
		if(mustman==''){
			layer.alert('请输入紧急联系人电话!',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}
		if(!(/^1[3|4|5|7|8|9][0-9]\d{4,8}$/.test(mustman))){
			layer.alert('紧急联系人手机号码错误!',{icon: 2,shade:0.8,title:"错误提示:"});return false;
		}

		$.ajax({
			type: 'POST',
			url: "{:url('User/certification')}",
			dataType: "html",
			data: "realname="+realname+"&selfcard="+code+"&mustman="+mustman,
			success:function(res){
                    var obj=JSON.parse(res);
                    console.log(obj);
                    if(obj.s==10){
                        layer.msg(obj.msg,{shade:0.6,time:1000,end:function(){
                            window.location.href=window.location.href;
                        }});
                    }else{
                        layer.alert(obj.msg,{shade:0.2});return false;
                    }
			},
			error:function(){
				layer.alert('系统繁忙，请稍后再试！',{icon: 2,shade:0.8,title:"错误提示:"});
			}
		});
	});

});
</script>
